using System;

namespace OST.Shared.Extensions
{
    public static class AngleExtensions
    {

        /// <summary>
        /// converts rad to degree's
        /// <remarks>based on C# Cookbook:
        /// http://books.google.de/books?id=eTCBSaNcS4cC&pg=PA5&lpg=PA5&dq=C%23+grad+multiplikation&source=bl&ots=SRZ3FZ3PHY&sig=ljVL1WFfHrHymDsTObx9RDKcYp4&hl=de&ei=hdOdTLmLNcbMswaEnLnmDg&sa=X&oi=book_result&ct=result&resnum=2&ved=0CBoQ6AEwAQ#v=onepage&q&f=false</remarks>
        /// </summary>
        /// <param name="rad">radian value</param>
        /// <returns>degree</returns>
        public static double Rad2Deg(this double rad)
        {
            return (180.0 / Math.PI) * rad;
        }
        /// <summary>
        /// converts degree to rad's
        /// based on C# Cookbook:
        /// http://books.google.de/books?id=eTCBSaNcS4cC&pg=PA5&lpg=PA5&dq=C%23+grad+multiplikation&source=bl&ots=SRZ3FZ3PHY&sig=ljVL1WFfHrHymDsTObx9RDKcYp4&hl=de&ei=hdOdTLmLNcbMswaEnLnmDg&sa=X&oi=book_result&ct=result&resnum=2&ved=0CBoQ6AEwAQ#v=onepage&q&f=false
        /// </summary>
        /// <param name="deg">degree value</param>
        /// <returns>rad</returns>
        public static double Deg2Rad(this double deg)
        {
            return (Math.PI / 180.0) * deg;
        }
    }
}
